import os
import traceback

def back_to_line(f,line):
    f.seek(0)
    for i in range(line-1):
        f.readline()
       

def compare(f1,f2,head1,head2,p1,p2):
    count_same,count_diff = 0,0
    while True:
        content1 = f1.readline()
        if not content1:break
        while True:
            data1 = content1.split(',')
            content2 = f2.readline()
            if not content2: break
            data2 = content2.split(',')
            if data1[0]==data2[0]:
                break
        if data1[p1]!=data2[p2]:
            count_diff+=1
        else:
            count_same+=1
    print(str.format("<file1----file2> {} same({})  diff({}) ",head1[p1],count_same,count_diff))
    return count_same,count_diff

if __name__=="__main__":
    while True:
        try:
            print("=============================================================")
            file1 =input("input first file(full path):")
            if file1.startswith('"') and file1.endswith('"'): file1=file1[1:-1]
            file2 = input("input second file(full path):")
            if file2.startswith('"') and file2.endswith('"'): file2=file2[1:-1]
            print("=============================================================")
            f1 = open(file1)
            f2 = open(file2)

            count1,count2=0,0
            dataline1,dataline2 = 0,0
            head1,head2=None,None
            for i in range(12):
                data1 = f1.readline()
                line1=data1.split(",")
                data2 = f2.readline()
                line2=data2.split(",")
                if len(line1)<3 and len(data1)>1: 
                    print("file1:",line1)
                elif len(line1)>1:
                    if head1==None: head1 = line1
                    count1 = len(line1)
                if len(line2)<3 and len(data2)>1: 
                    print("file2:",line2)
                elif len(line2)>1:
                    if head2==None: head2 = line2
                    count2 = len(line2)

                if len(line1)>1 and len(line1[0])>1:
                    dataline1 = i
                if len(line2)>1 and len(line2[0])>1:
                    dataline2 = i

            print(str.format("file1 has {} parameters",count1))
            print(str.format("file2 has {} parameters",count2))

            count_param = 0
            for i in range(count1):
                back_to_line(f1,dataline1)
                back_to_line(f2,dataline2)
                try:
                    j = head2.index(head1[i])
                    s,d = compare(f1,f2,head1,head2,i,j)
                    if d==0:count_param=count_param+1
                except ValueError:
                    pass
            
            print(str.format(">>>>>>>> {} parameters has no different",count_param))
            f1.close()
            f2.close()
        except Exception:
            traceback.print_exc()